﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Edu.Web.Data.DV;
using Edu.Web.Data.Entity;

namespace Edu.Web.Data.DAO.Impl
{
    public partial class CourceExamDAO
    {
        public IQueryable<CourceScoreDV> GetCourceScoreList()
        {
            return from cs in Db.Set<CourceExamScoreEntity>()
                   join ce in Db.Set<CourceExamEntity>() on cs.CourceExamId equals ce.Id
                   join clazz in Db.Set<ClazzEntity>() on ce.ClazzId equals clazz.Id
                   join cource in Db.Set<CourceEntity>() on ce.CourceId equals cource.Id
                   join stu in Db.Set<UserEntity>() on cs.UserId equals stu.Id
                   join techer in Db.Set<UserEntity>() on ce.CreateUserId equals techer.Id
                   orderby ce.CreateTime descending
                   select new CourceScoreDV
                   {
                       Id = cs.Id,
                       ClazzId = clazz.Id,
                       ClazzName = clazz.ClazzName,
                       CourceId = ce.CourceId,
                       CreateUserId = ce.CreateUserId,
                       CourceName = cource.CourceName,
                       CreateRealName = techer.RealName,
                       CreateTime = ce.CreateTime,
                       Remark = cs.Remark,
                       Score = cs.Score,
                       StuRealName = stu.RealName,
                       Title = ce.Title,
                       UserId = cs.UserId
                   };
        }
    }
}